Is it possible to access javascript return value outside of function? [on hold]

Posted by Kinnard Hockenhull on Programmers See other posts from Programmers or by Kinnard Hockenhull
Published on 2013-10-31T19:24:49Z Indexed on 2013/10/31 22:17 UTC
Read the original article Hit count: 173

Filed under:

How would one access javascript function's return value outside of the function? For example could you tell a function to return something somewhere else in the code? Theoretical example:

milkmachine = function(argument){
    var r;
    var k;
    //do something with arguments and variables
    return r;
}
var rainbow = milkmachine(); //rainbow == r
milkmachine.return(k);
var spectrum = milkmachine(); //spectrum == k

© Programmers or respective owner

Related posts about JavaScript